﻿package com.tudou.home.newskin.containers
{
    import com.tudou.home.consts.*;
    import flash.display.*;

    public class AdCornerFloatSprite extends Sprite implements IAdFloatCorner
    {
        private var adCorner:DisplayObject;
        private var adFloat:DisplayObject;

        public function AdCornerFloatSprite()
        {
            return;
        }// end function

        override public function get width() : Number
        {
            if (adCorner && this.contains(adCorner))
            {
                return AdSize.CORNER_WIDTH;
            }
            if (adFloat && this.contains(adFloat))
            {
                return adFloat.width;
            }
            return 0;
        }// end function

        public function setAdFloat(param1:DisplayObject) : void
        {
            removeAll();
            adFloat = param1;
            addChild(adFloat);
            return;
        }// end function

        public function setAdCorner(param1:DisplayObject) : void
        {
            removeAll();
            adCorner = param1;
            addChild(adCorner);
            return;
        }// end function

        private function removeAll() : void
        {
            while (this.numChildren > 0)
            {
                
                this.removeChildAt(0);
            }
            return;
        }// end function

        override public function get height() : Number
        {
            if (adCorner && this.contains(adCorner))
            {
                return AdSize.CORNER_HEIGHT;
            }
            if (adFloat && this.contains(adFloat))
            {
                return adFloat.height;
            }
            return 0;
        }// end function

    }
}
